


import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;


@SuppressWarnings("serial")
public class PnlFondo extends javax.swing.JPanel {
		
		ImageIcon imagen;
		public PnlFondo(String nombre) {
			super();
			setPreferredSize(new Dimension(400, 300));
			imagen = new ImageIcon(getClass().getResource(nombre));
			setSize(imagen.getIconWidth(),imagen.getIconHeight());
		}
		
		protected void paintComponent(Graphics g)
		{
			Dimension size = getSize();
			g.drawImage(imagen.getImage(),0,0,size.width,size.height,null);
			this.setOpaque(false);
			super.paintComponents(g);
		}

}


